package view;

import entity.Color;
import service.FineServiceImpl;
import tool.MyTool;
import tool.TSUtility;

public class FineView {


    public static void fineMenu() {
        FineServiceImpl fineService = new FineServiceImpl();
        while (true) {
            System.out.print(Color.getAnsiBlue() + Color.getAnsiGreen());
            System.out.println("🔣-------~罚金设置系统~-----------🔣");
            System.out.println("🐕-------<1.添加罚金设置>------*");
            System.out.println("🐖-------<2.删除罚金设置>------*");
            System.out.println("🐱-------<3.修改罚金设置>------*");
            System.out.println("🐱-------<4.查看罚金设置>------*");
            System.out.println("🐱-------<5.退出>------------*");
            char c = MyTool.selectMenu(5).charAt(0);
            int jundment = fineService.jundment();
            switch (c) {

                case '1':
                    fineService.insert();
                    break;

                case '2':
                    if (jundment==0){
                        System.out.println("暂无罚金设置，无法删除，请先前往添加");
                        break;
                    }
                    fineService.deleteById();
                    break;

                case '3':

                    if (jundment==0){
                        System.out.println("暂无罚金设置，无法修改，请先前往添加");
                        break;
                    }
                    fineService.update();
                    break;
                case '4':
                    if (jundment==0){
                        System.out.println("暂无罚金设置，无法查看，请先前往添加");
                        break;
                    }
                    fineService.getAll();
                    break;
                case '5':
                    return;

            }
        }
    }

    public static void main(String[] args) {
//        FineView.fineMenu();
       BorrowBookView.BorrowBookView();
    }
}
